package com.jtfr.core;

import java.util.Properties;

import com.jtfr.util.PropsUtil;


/**
 * 读取Properties获取, 然后 set 进去。
 * @author ckm
 *
 */
public class Config {
 
	// 配置文件的名称, 后面改成没有才使用默认名称
	private static final String CONFIG_NAME = "SimpleMybatis.properties";
	// 读取配置文件里面的值
	private static final Properties CONFIG_PROPS = PropsUtil.loadProps(CONFIG_NAME);
	// Config 实例
    private static final Config INSTANCE = new Config();
 
    private Config() {}
    /**
     * 单例模式
     * @return
     */
    public static Config getConfig() {
    	return INSTANCE;
    }
    
    private String url = PropsUtil.getString(CONFIG_PROPS, "url");
    private String username = PropsUtil.getString(CONFIG_PROPS, "username");
    private String password = PropsUtil.getString(CONFIG_PROPS, "password");
 
    private String mapperPath = PropsUtil.getString(CONFIG_PROPS, "mapperPath");
    
    private Integer connectionPoolSize = PropsUtil.getInt(CONFIG_PROPS, "connectionPoolSize");

	public String getUrl() {
		return url;
	}
	
	public String getUsername() {
		return username;
	}
	
	public String getPassword() {
		return password;
	}
	
	public String getMapperPath() {
		return mapperPath;
	}
	
	public Integer getConnectionPoolSize() {
		return connectionPoolSize;
	}

}
